<template>
	<view class="cl-page">
		<!-- toast -->
		<u-toast ref="toast" />

		<!-- tigs-->
		<u-top-tips ref="tips"></u-top-tips>

		<!-- confirm -->
		<u-modal v-model="confirmShow" :title="confirm.title" :content="confirm.content"></u-modal>

		<!-- content -->
		<slot></slot>
	</view>
</template>

<script>
import { mapGetters } from "vuex";

export default {
	componentName: "CLPage",

	data() {
		return {
			confirmShow:false,
			confirm: {
				title: '',
				content: "",
			},
		};
	},
	created() {
		const { showMessage, showToast,showConfirm } = this;
		console.log('init') 
		this.$parent.$app = {
			showMessage,
			showToast,
		};
	},

	methods: {
		showMessage(title,type,duration) {
			this.$refs["tips"].show({
				title: title,
				type: type || 'success ',
				duration: duration || '2000'
			});
		},

		showToast(title,type,url) {
			this.$refs["toast"].show({
				title: title,
				type: type || 'default',
				url: url || ''
			});
		},
	},
};
</script>
